home *** CD-ROM | disk | FTP | other *** search
- Path: yoyo.cc.monash.edu.au!not-for-mail
- From: bcheung@yoyo.cc.monash.edu.au (Biggles Cheung)
- Newsgroups: comp.lang.c
- Subject: Re: Does C convert float to double internally ?
- Date: 3 Apr 1996 23:44:56 GMT
- Organization: Monash University
- Message-ID: <4jv2ho$r1o@harbinger.cc.monash.edu.au>
- References: <4jsllh$hkf@harbinger.cc.monash.edu.au>
- NNTP-Posting-Host: yoyo.cc.monash.edu.au
- X-NNTP-Posting-User: bcheung
- X-Newsreader: TIN [UNIX 1.3 950823BETA PL0]
-
- Biggles Cheung (bcheung@yoyo.cc.monash.edu.au) wrote:
- : I was told that C compiler automatically converts "float" variable
- : internally to "double" for + - * / , etc operations. Is this true?
-
- After I have read some books on C/C++, they all say that K&R C used to
- do _implicit_ conversion from float to double both in unary and binary
- operations, while ANSI C has dropped the implicit conversion and happily
- allows float to be float at all time.
-
- Can I safely assume now that ALL current C/C++ compliers are following ANSI C
- standard?
-
- :
- : Can I force the C compiler not to do the conversion as I have an
- : assignment on finding out various computing errors of different
- : precisions?
- :
-
- I have read also the Turbo C++ manual and it says "tcc -ff- " command
- line option can force the command line compiler to follow STRICT ANSI C
- rule on conversion, i.e. no implicit conversion.
-
- Can I now be sure that if I use "tcc -ff- program.c", there is _no_
- implicit conversion? But what about the IDE interface?
-
- Can someone suggest a simple program to test if there is any implicit
- conversion happening behind the curtain?
-
-
- : My advice from the lecturer is to have temporary variable of
- : float to split a long equation to smaller step so that I can maximize
- : the impact of single precision number on the evaluation. Is this
- : feasible?
- :
-
- If I am to find the single precision value of say, 12.3457 to the power
- of 13 by multiplying 12.3456 thirteen times, does that mean I have to
- store the result of every _single_ multiplication to a temporary variable
- of float to enforce the single precision?
-
- What if I have a very complicated mathematical expression like Taylor's
- series plus sqrt plus more ... ? How many temporary variables I need and
- when is the best time or where is the best spot to insert such
- _nuisance_?
-
-
- --
-
-
- _/\/\/\/\/\___/\/\_________________________/\/\_________________________
- _/\/\____/\/\__________/\/\/\/\___/\/\/\/\_/\/\_____/\/\/\_____/\/\/\/\_
- _/\/\/\/\/\___/\/\___/\/\__/\/\_/\/\__/\/\_/\/\___/\/\/\/\/\_/\/\/\/\___
- _/\/\____/\/\_/\/\_____/\/\/\/\___/\/\/\/\_/\/\___/\/\_____________/\/\_
- _/\/\/\/\/\___/\/\/\_______/\/\_______/\/\_/\/\/\___/\/\/\/\_/\/\/\/\___
- ____________________/\/\/\/\___/\/\/\/\_________________________________
-
- / biggles@c031.aone.net.au \
- \ bcheung@yoyo.cc.monash.edu.au / ~~ Biggles CHEUNG
-
-
-
-